package com.dcms.admin.controller;

import com.dcms.admin.bean.User;
import org.apache.log4j.Logger;
import org.springframework.beans.factory.annotation.Autowired;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpSession;

/**
 * \* @name: BaseController
 * \* @author: 武佳伟丶
 * \* @date: 2018/2/10 0010
 * \* @tine: 19:48
 * \* @description: To change this template use File | Settings | File Templates.
 * \
 */
public class BaseController {

    private static final long serialVersionUID = 6357869213649815390L;

    @Autowired
    protected HttpServletRequest request;

    @Autowired
    protected HttpSession session;

    protected Logger logger = Logger.getLogger(this.getClass());

    protected void logBefore(Logger logger, String interfaceName){
        logger.info("");
        logger.info("start");
        logger.info(interfaceName);
    }

    protected void logAfter(Logger logger){
        logger.info("end");
        logger.info("");
    }

    protected User getCurrentUser(){
        User user = (User)session.getAttribute("USER");
        return user;
    }

}